<template>
  <div>
    <good-review-show-box ref="box" style="margin: 40px 0 50px;" :good-id="goodId" @countChange="countChange"/>
    <add-review-box style="margin: 40px 0 20px;"  :good-id="goodId" @success="addReviewSuccess"/>
  </div>
</template>

<script>
import AddReviewBox from '@/views/part/shopDetail/part/goodInfo/part/tableReviews/AddReviewBox'
import GoodReviewShowBox from '@/views/part/shopDetail/part/goodInfo/part/tableReviews/GoodReviewShowBox'
export default {
  name: 'TabReviews',
  components: { GoodReviewShowBox, AddReviewBox },
  props: {
    data: {
      required: true,
      type: Object
    }
  },
  data () {
    return {

    }
  },
  methods: {
    countChange (newCount) {
      this.$emit('countChange', newCount)
    },
    addReviewSuccess () {
      this.$refs.box.freshData()
    }
  },
  computed: {
    haveGood () {
      return this.data && this.data.id && this.data.id > 0
    },
    goodId () {
      return this.haveGood ? this.data.id : 0
    }
  }
}
</script>

<style scoped>

</style>
